package com.sm.user.swagger;

import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;


/**
 * @program: practice
 * @description:
 * @author: liqitian.
 * @create: 2019-11-20 14:08
 **/

@Configuration
@EnableSwagger2
//@EnableSwaggerBootstrapUi
public class Swagger2Config {

    @Bean
    public Docket createRestApi() throws UnknownHostException {

        Docket docket =    new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.sm.user.controller"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Shopping-Mall 用户服务接口文档")
                .contact(new Contact("liqitian3344", "https://www.liqitian.com", "192253540@qq.com.com"))
                .version("v1.0.0")
                .description("😆😆😆😆😆😆😆😆")
                .build();
    }

}
